/**
 * @param {string} s
 * @param {number[]} distance
 * @return {boolean}
 */
var checkDistances = function(s, distance) {
    const map = new Map()
    const getNumber = (index) => {
        return s.charCodeAt(index) - 97;
    }
    for(let i = 0; i < s.length; i++) {
        let tempKey = getNumber(i)
        if(!map.has(tempKey)) {
            map.set(tempKey, i)
        } else {
            map.set(tempKey, i - map.get(tempKey) - 1)
        }
    }
    for(let j = 0; j < distance.length; j++) {
        if(!map.has(j)) continue
        if(map.get(j) !== distance[j]) return false
    }
    return true;
};
console.log(checkDistances("abaccb", [1,3,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]));